<?php

error_reporting(0);
session_start();
error_reporting(1);

$id = $_POST['id'];
$type = $_POST['type'];

$firstname = addslashes($_POST['firstname']);
$lastname = addslashes($_POST['lastname']);
$birthday = $_POST['birthday'];
$email = $_POST['email'];
$sex = $_POST['sex'];
$city = $_POST['city'];
$state = $_POST['state'];
$country = $_POST['country'];
$website = $_POST['website'];
$screenname = $_POST['screenname'];
$phone = $_POST['phone'];
$carrier = $_POST['carrier'];
$cellnotify = $_POST['cellnotify'];
$email_notify = $_POST['email_notify'];

$medium = addslashes($_POST['medium']);
$influences = addslashes($_POST['influences']);
$hobbies = addslashes($_POST['hobbies']);
$interests = addslashes($_POST['interests']);
$general = addslashes($_POST['general']);

echo $id;

require_once "../common/PinSQL.obj";
$pinSQL = new PinSQL();

if ($type == "personal")
{
	$pinSQL->Query("UPDATE members SET 
		firstname='$firstname', 
		lastname='$lastname', 
		email='$email' 
	WHERE id=$id");

	$pinSQL->Query("UPDATE memberdata SET 
		sex='$sex', 
		city='$city', 
		state='$state', 
		country='$country', 
		website='$website', 
		screenname='$screenname', 
		phone='$phone',
		carrier='$carrier', 
		cellnotify='$cellnotify',
		email_notify='$email_notify',
		birthday='$birthday'
	WHERE id=$id");
}	else if ($type == "artist")
{
	$pinSQL -> Query("UPDATE memberdata SET
		medium='$medium',
		influences='$influences',
		hobbies='$hobbies',
		interests='$interests',
		general='$general'
	WHERE id=$id");
		
}
	$user = $_SESSION['username'];

if ($pinSQL->GetPrivacyField($_SESSION['id'], "profilechange") == 1)
{
	mysql_query("INSERT INTO activity
	(event_type, by_user, url_1)
	VALUES('profile-edit', '$user',
	'/members/frame.php?page=profile&user=$user') ")
	or die(mysql_error());
}

	
$pinSQL->Close();

?>